/*
 * @Description: 二级部分页面公共头部
 * @Date: 2021-07-30 18:21:37
 * @Author: 张自文
 * @LastEditTime: 2021-07-30 18:28:17
 * @LastEditors: 张自文
 * @FilePath: \nxetc\lib\pages\mybill\common_head_widget.dart
 */
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class CommonHeadWidget extends StatelessWidget {
  CommonHeadWidget({Key? key}) : super(key: key);
  final CommonHeadWidgetController vm = Get.put(CommonHeadWidgetController());

  @override
  Widget build(BuildContext context) {
    return const Text('测试页');
  }
}

//头部样式渲染
class CommonHead extends CustomClipper<Path> {
  ///返回的裁切的路径
  @override
  Path getClip(Size size) {
    final Path path = Path();
    path.lineTo(0, size.height - 50.0.w); //声明起点
    ///绘制第1个拐点开始
    final Offset startPoint = Offset(0, size.height - 50.0.w);

    ///绘制第1个拐点结束
    final Offset middlePoint = Offset(size.width / 2, size.height);

    ///绘制右侧拐点开始
    final Offset endPoint = Offset(size.width, size.height - 50.0.w);

    path.cubicTo(
      startPoint.dx,
      startPoint.dy,
      middlePoint.dx,
      middlePoint.dy,
      endPoint.dx,
      endPoint.dy,
    );

    path.lineTo(size.width, 0);
    return path;
  }

  ///是否需要裁切，默认裁切
  @override
  bool shouldReclip(CustomClipper<Path> oldClipper) {
    return false;
  }
}

class CommonHeadWidgetController extends GetxController {}
